const mongoose = require("mongoose");
const Schema = mongoose.Schema;

var url = "mongodb://127.0.0.1:27017/runoob";

const db = mongoose.connect(url, { useNewUrlParser: true }, function(err) {
  if (err) {
    console.log(err);
  } else {
    console.log("Connection success!");
  }
});

// 用户
export let UserInfoSchema = new Schema({
  name: {
    type: String,
    default: "李四"
  },
  age: {
    type: Number,
    default: 10
  }
});

export default {
  UserInfo: mongoose.model("UserInfo", UserInfoSchema)
};
